package com.course.server.utils;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@Getter
@AllArgsConstructor
public enum ResponseStatus {
    SUCCESS(20000, "success"), // 业务成功状态码
    FAIL(20001, "failed"), // 业务失败状态码
    UNKNOWN_ERROR(-1, "unknown error"),
    NOT_EXISTS(10001,"not exists"),

    HTTP_STATUS_200(200, "request ok"),
    HTTP_STATUS_400(400, "request error"),
    HTTP_STATUS_401(401, "no authentication"),
    HTTP_STATUS_403(403, "no authorities"),
    HTTP_STATUS_404(404, "notfound"),
    HTTP_STATUS_500(500, "server error");

    public static final List<ResponseStatus> HTTP_STATUS_ALL = Collections.unmodifiableList(
            Arrays.asList(HTTP_STATUS_200, HTTP_STATUS_400, HTTP_STATUS_401, HTTP_STATUS_403,HTTP_STATUS_404, HTTP_STATUS_500
            ));

    /**
     * response code
     */
    private final int responseCode;

    /**
     * description.
     */
    private final String description;

}
